package com.example.demo.controller;
/*
 * 李洲 2020030654A1213
 * 2024.05.24
 */
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/example")
public class RedirectController {

    // 处理初始请求，并重定向到 "/redirected"
    @GetMapping("/redirect")
    public String redirect() {
        return "redirect:/example/redirected";
    }

    // 处理重定向后的请求
    @GetMapping("/redirected")
    public String redirected() {
        return "You have been redirected!";
    }
}
